package com.wutuo.aggragation.expire.component;


import com.wutuo.aggragation.expire.domain.ExpireManagement;
import com.wutuo.aggragation.expire.dto.RosterExpireManagementLatestDto;
import com.wutuo.aggragation.expire.response.ExpireManagementLatestResponse;
import com.wutuo.aggragation.expire.response.ExpireManagementResponse;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by admin on 16-5-7.
 */
public class ExpireManagementConvertor {

    public static List<ExpireManagementResponse> convert(List<ExpireManagement> datas) {
        List<ExpireManagementResponse> result = new ArrayList<ExpireManagementResponse>();
        for (ExpireManagement em : datas) {
            ExpireManagementResponse emr = new ExpireManagementResponse();
            emr.setExpireDate(em.getExpireDate());
            emr.setId(em.getId());
            emr.setStartDate(em.getStartDate());
            result.add(emr);
        }
        return result;
    }

    public static List<ExpireManagementLatestResponse> convertToExpireManagementLatestResponse(List<RosterExpireManagementLatestDto> datas) {
        List<ExpireManagementLatestResponse> result = new ArrayList<ExpireManagementLatestResponse>();
        for (RosterExpireManagementLatestDto dto : datas) {
            ExpireManagementLatestResponse res = new ExpireManagementLatestResponse();
            res.setId(dto.getId());
            res.setExpireDate(dto.getExpireDate());
            res.setRosterId(dto.getRosterId());
            res.setRosterName(dto.getRosterName());
            res.setSmsDate(dto.getSmsDate());
            res.setRosterImg(dto.getRosterImg());
            res.setYear(dto.getYear());
            res.setGrade(dto.getGrade());
            result.add(res);
        }
        return result;
    }

}
